﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.IO;

namespace MVCHelpers
{
    internal static class EmbeddedResources
    {

        /// <summary>
        /// Read the contents of a file located at the "EmbeddedResources" directory.
        /// </summary>
        /// <param name="fileName">The name of the file to read.</param>
        /// <returns></returns>
        public static string ReadText(string fileName)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();

            using (StreamReader streamReader = new StreamReader(assembly.GetManifestResourceStream("MVCHelpers.EmbeddedResources." + fileName)))
            {
                return streamReader.ReadToEnd();
            }
        }
    }
}
